<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="lib/jquery.3.6.0.js"></script>

</head>
<body>
    <div><input type="text"><button>搜索</button></div>
    <h1>
    
    </h1>
    <h2></h2>
    <script>
        // $(function(){
        //     $.get('http://127.0.0.1:3001/getHeroSkin',{heroName:'孙尚香'},function(res){
        //       $('h1').text(res.data.cname)
        //       $('h2').text(res.data.skin_name)
        //     })
        // })
        $(function(){
            $('button').click(function(){
            const heroName=$("input").val().trim()
            if(!heroName){
                alert('请输入英雄名称')
                return
            }
                $.get('http://127.0.0.1:3001/getHeroSkin',{heroName},function(res){
                    console.log(res);
                    $('h1').text('名字:'+res.data.cname)
                    $('h2').text('皮肤:'+res.data.skin_name)
                })
            })
        })
    </script>
</body>
</html>